<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	    		xmlns:ui="http://java.sun.com/jsf/facelets"
	  			xmlns:h="http://java.sun.com/jsf/html"
	  			xmlns:f="http://java.sun.com/jsf/core"                
                xmlns:cs="http://myfaces.apress.com/custom"
				template="/WEB-INF/layouts/standard.xhtml"
				xmlns:a4j="http://richfaces.org/a4j"
				xmlns:rich="http://richfaces.org/rich"
				xmlns:bf="http://www.bssmanager.com/jsf"
				xmlns:c="http://java.sun.com/jstl/core">

	<ui:define name="headIncludes">
		<style>
			.modalPanelInternal {
				width:100%;
				height:300px;
				overflow:auto;
				margin: 0px;
				padding: 0px;
			}
			
			
		</style>

		<script type="text/javascript">
			var childW = null;
	
			function launchChildW() {				
			  var url = "${request.contextPath}/webcam.jsp";			   
			  wopts  = 'width=300,height=300,resizable=1,alwaysRaised=1,scrollbars=1,modal=yes';	
			  if (window.showModalDialog) {
					window.showModalDialog(url,self,wopts);
				} else {
					window.open(url,'Popup',wopts);
				}
			}
					
			function setImage(im) {
				
				var ee = document.getElementById('snap');
				while (ee.hasChildNodes()) {
			        ee.removeChild(ee.firstChild);
			    }			   
			    var element1 = document.createElement("img");
			    element1.src = "${request.contextPath}/" + im;
			    element1.id = "imgctrl";
			    element1.alt = "No Protograph";
			    element1.width= 320;
			    element1.height=240;
			    ee.appendChild(element1);	

			    var ee1 = document.getElementById('confirmSnap');
				while (ee1.hasChildNodes()) {
			        ee1.removeChild(ee1.firstChild);
			    }			   
			    var element11 = document.createElement("img");
			    element11.src = "${request.contextPath}/" + im;
			    element11.id = "imgctrl2";
			    element11.alt = "No Protograph";
			    element11.width= 320;
			    element11.height=240;
			    ee1.appendChild(element11);	 

			             
			}			
		</script>
	</ui:define>
	
	<ui:define name="formheader">
		<h2>Check In</h2>
	</ui:define>
	

	<ui:define name="formGlobal">
		<bf:dateSelector controller="#{admissionController}"  date="date" ajaxUpdate="false"/>
	</ui:define>
	
	<ui:define name="content">
	
	<h:form>
				
	<div align="left">					
		<bf:patientSelector controller="#{admissionController}" selectMethod="select" reRender="selectedPatients1,selectAttendentWindow"/>											
	</div>
	
	<table width="100%">
			<tr>
				<td valign="top" align="right"> 
					<a4j:commandButton 	action="#{admissionController.validate}" status="valsub"
										value="Submit" 
										reRender="showErrorsWindow,confirmAdmissionWindow" 
										oncomplete="if(#{admissionController.error}) Richfaces.showModalPanel('showErrorsWindow'); else Richfaces.showModalPanel('confirmAdmissionWindow');"/>
							<a4j:status  id="valsub" >
								 <f:facet name="start">
					                  <h:graphicImage value="/images/im1.gif"/>
					             </f:facet>
							</a4j:status>	
				</td>
				<td>
					<h:commandButton value="Clear" action="#{admissionController.cancel}"/>
					
					<a4j:commandButton 	action="#{admissionController.cancel}" status="valsub1234"
										value="Clear" 
										reRender="roomSelectionWindow,dormitorySelectionPanel,showErrorsWindow,submitStatusWindow,selectAttendentWindow,confirmAdmissionWindow,selectedPatients1,selectedPatients2,selectedPatients3"/>
									<a4j:status id="valsub1234" forceId="true">
										 <f:facet name="start">
							                  <h:graphicImage value="/images/im1.gif"/>
							             </f:facet>
									</a4j:status>
				</td>
			</tr>	
	</table>
	
	<rich:panel style="border:0px; width:100%;" id="selectedPatients1">
		<table width="100%" align="left" style="text-align: left; table-layout: fixed">			
			<tr>
				<td colspan="2" valign="top">	
						<bf:patient model="#{admissionController.model.patient}"
										showAddUpdateCancel="false" 
										editing="false"
										showData="false"/>
				</td>
			</tr>
			<tr>
				<td colspan="1" style="background-color: #FFBF80; font-weight: bolder; font-size: 10pt;" align="center">
					Medical Details
				</td>
				<td colspan="1" style="background-color: #FFBF80; font-weight: bolder; font-size: 10pt;" align="center">
					Stay Details
				</td>
			</tr>			
			<tr>
				<td colspan="1" valign="top">
						<h:panelGrid columns="2">
							<h:outputLabel value="Medical Problem"/>
							<rich:comboBox  value="#{admissionController.model.medicalProblem}"
											suggestionValues="#{medicalProblemDao.all}"
											converter="#{medicalProblemConverter}"
											enableManualInput="false"/>
							<h:outputLabel value="Case Number:"/>
							<h:inputText size="5" value="#{admissionController.model.caseNo}"/>							
						</h:panelGrid>
				</td>
				<td valign="top" align="left">
					<h:panelGrid columns="2">							
							<h:outputLabel value="Town of Last Departure"/>
							<h:inputText size="5" value="#{admissionController.model.townOfLastDeparture}"/>
							<h:outputLabel value="Stay from: "/>
							<rich:calendar inputSize="12" enableManualInput="false" value="#{admissionController.model.dateFrom}" datePattern="dd MMM yy HH:mm"/>
							<h:outputLabel value="Stay to: "/>
							<rich:calendar inputSize="12" enableManualInput="false" value="#{admissionController.model.dateTo}" datePattern="dd MMM yy HH:mm" />
						</h:panelGrid>
				</td>
			</tr>
			<tr style="background-color: #FFBF80">
				<td colspan="2" style="font-weight: bolder; font-size: 10pt;" align="center">
					Attendants
				</td>
			</tr>
			<tr>				
				<td colspan="2" valign="top">
					<a href="#" onclick="Richfaces.showModalPanel('selectAttendentWindow');">Find</a>
							<h:panelGroup id="attendentsPanel">
							<bf:attendent model="#{admissionController.currentAttendent}"
												addMethod="addAttendent"
												removeMethod="deleteAttendent"
												selectMethod="selectAttendent"
												existing="attendents"
												data="#{admissionController.currentAttendentsData}"			
												controller="#{admissionController}"
												reRender="selectAttendentWindow"
												showSuggestion="#{admissionController.model.patient.id ne 0}"/>				
							</h:panelGroup>							
				</td>
			</tr>
		</table>
	</rich:panel>
	
	<rich:panel style="border:0px; width:100%;" id="selectedPatients3">
		<table width="100%">			
			<tr style="background-color: #FFBF80">
				<td colspan="2" align="center" style="font-weight: bolder; font-size: 10pt;" >
					Material Set
				</td>
			</tr>
			<tr>
				<td colspan="2" valign="top">																	
						<h:panelGrid columns="8">			
							<c:forEach items="#{admissionController.materialAllocations}" var="materialAllocation">
								<h:outputLabel value="#{materialAllocation.materialType.name}"/>
								<h:inputText size="1" value="#{materialAllocation.instances}" style="margin-right: 5px;"/>
							</c:forEach>									
						</h:panelGrid>			
				</td>				
			</tr>
			<tr style="background-color: #FFBF80">
				<td colspan="2" align="center" style="font-weight: bolder; font-size: 10pt;" >
					Utensil Set
				</td>				
			</tr>
			<tr>				
				<td colspan="2" valign="top">																	
						<h:panelGrid columns="3" >							
							<h:outputLabel value="Utensils Set:"/>
							<rich:comboBox  value="#{admissionController.model.materialSet}"
											suggestionValues="#{admissionController.materialSetList}"
											converter="#{materialSetConverter}"
											enableManualInput="false" 
											width="100">
											<a4j:support event="onchange" reRender="utensilSetPanel,utensilDepositAmount" 
															action="#{admissionController.submit}"
															status="uscost"/>
							</rich:comboBox>
							<a4j:status forceId="true" id="uscost" >
								 <f:facet name="start">
					                  <h:graphicImage value="/images/im1.gif"/>
					             </f:facet>
							</a4j:status>
							<h:outputLabel value="Utensil Deposit: "/>
							<h:outputText id="utensilDepositAmount" value="#{admissionController.model.materialSet.deposit}"/>								
						</h:panelGrid>
						<rich:panel id="utensilSetPanel">
							<f:facet name="header" >
								<h:outputText value="Items: "/>
							</f:facet>
							<h:panelGrid columns="16" >			
								<c:forEach items="#{admissionController.model.materialSet.materialSetMappings}" var="materialSetMapping">
									<h:outputLabel value="#{materialSetMapping.materialType.name}"/>
									<h:outputText value="#{materialSetMapping.instances}" style="margin-right: 10px;color:green;"/>
								</c:forEach>									
							</h:panelGrid>								
						</rich:panel>
				</td>
			</tr>		
		</table>		
	</rich:panel>	
		

	
	<rich:panel style="border:0px; width:100%;" id="selectedPatients2">
		<table width="100%">
			<tr style="background-color: #FFBF80">
				<td colspan="2" align="center" style="font-weight: bolder; font-size: 10pt;" >
					Accommodation(#{admissionController.count})
				</td>				
			</tr>			
			<tr>
				<td colspan="2" valign="top" align="left">
					<h:panelGrid columns="2">			
							<h:panelGroup>				
								<h:outputLabel value="Rooms: "/><a href="#" onclick="Richfaces.showModalPanel('roomSelectionWindow');">Select Rooms</a>
								<h:panelGroup id="selectedRooms">			
									<c:set var="found" value="0"/>
									<ul>				
										<c:forEach items="#{admissionController.buildings}" var="building">
											<c:forEach items="#{building.rooms}" var="room">
												<c:if test="#{ not room.dormitory and room.selected}">					
													<li>#{room.roomNumber} ( #{building.name} )</li>
													<c:set var="found" value="1"/>
												</c:if> 	
											</c:forEach>
										</c:forEach>
										<c:if test="#{found eq 0}" >	
											<li>No Rooms Selected</li>
										</c:if>		
									</ul>
								</h:panelGroup>
							</h:panelGroup>
							<h:panelGroup>
								<h:outputLabel value="Dormitory Beds: "/> <a href="#" onclick="Richfaces.showModalPanel('dormitorySelectionWindow');">Select Beds</a>
								<h:panelGroup id="selectedDormitories">			
									<c:set var="found" value="0"/>
									<ul>
										<c:forEach items="#{admissionController.buildings}" var="building">
											<c:forEach items="#{building.rooms}" var="room">
												<c:if test="#{room.dormitory}" >
													<c:forEach items="#{room.beds}" var="bed">
														<c:if test="#{ bed.selected}" >	
															<li>#{bed.bedNumber} ( #{building.name} - #{room.roomNumber} )</li>
															<c:set var="found" value="1"/>
														</c:if>
													</c:forEach>
												</c:if> 	
											</c:forEach>
										</c:forEach>
										<c:if test="#{found eq 0}" >	
											<li>No Beds Selected</li>
										</c:if>		
									</ul>
								</h:panelGroup>
							</h:panelGroup>
						</h:panelGrid>
				</td>				
			</tr>
		</table>
	</rich:panel>
	

	
</h:form>	
		
							
	<rich:modalPanel id="roomSelectionWindow" minHeight="300" minWidth="600" autosized="true"
			zindex="2000" height="300"  >
			<f:facet name="header">
				<h:outputText value="Rooms"/>
			</f:facet>
			<f:facet name="controls">
            	<h:graphicImage value="/images/close.gif" 
            					style="cursor:pointer" 
            					onclick="Richfaces.hideModalPanel('roomSelectionWindow')" />
      		</f:facet>
		<div class="modalPanelInternal">		
			<h:form>
				<c:forEach items="#{admissionController.buildings}" var="building">
					<h4 style="text-decoration: underline;">#{building.name}</h4>
					<c:forEach begin="1" end="#{building.floors}" var="floor">
						<h5>Floor #{floor}</h5>		
							<h:panelGroup>															
									<h:panelGrid columns="3">
										<c:set var="found" value="0"/>
										<c:forEach items="#{building.rooms}" var="room">
											<c:if test="#{not room.dormitory and room.floor eq floor}">
												<h:panelGroup>
													<div style="height:75px; text-align: left; padding:5px; margin: 5px; border: thin solid grey; #{room.occupied ? 'background-color: gray;':''}">																
														<div><h:selectBooleanCheckbox value="#{room.selected}" disabled="#{room.occupied}" />  #{room.roomNumber}</div>
														<h:panelGroup layout="block">															
															<div>Rate(A): #{room.rate}</div>
														</h:panelGroup>
														<h:panelGroup rendered="#{not room.occupied}" layout="block">															
															<div>Rate(P):<h:inputText value="#{room.proposedRate}" style="font-size:8pt;width: 23px;"/></div>
														</h:panelGroup>														
													</div>													
												</h:panelGroup>
												<c:set var="found" value="1"/>
											</c:if>															
										</c:forEach>
									</h:panelGrid>
									<c:if test="#{found eq 0}" >
										No Rooms found
									</c:if>
							</h:panelGroup>
							<hr/>
						</c:forEach>			
					</c:forEach>		
				<br/>		
				<a4j:commandButton value="Done" action="#{admissionController.action}" reRender="selectedRooms" oncomplete="Richfaces.hideModalPanel('roomSelectionWindow');"/>
											
			</h:form>
		</div>		
	</rich:modalPanel>
	
	<rich:modalPanel id="dormitorySelectionWindow" minHeight="300" minWidth="600" autosized="true" zindex="2000"  >
		<f:facet name="header">
			<h:outputText value="Dormitories"></h:outputText>
		</f:facet>
		<f:facet name="controls">
          		<h:graphicImage value="/images/close.gif" 
          					style="cursor:pointer" 
          					onclick="Richfaces.hideModalPanel('dormitorySelectionWindow')" />
    			</f:facet>
    	<h:form> 				
		<div class="modalPanelInternal">
		
			
			
			<h:panelGroup id="dormitorySelectionPanel">
								
			<c:forEach items="#{admissionController.buildings}" var="building">
				<h:panelGroup>											
					<c:forEach items="#{building.rooms}" var="room">
						<c:if test="#{room.dormitory}">
							<h:panelGroup>
								<h:panelGroup layout="block">
									<h:outputText style="text-decoration: underline;" value="#{building.name} - Dormitory #{room.roomNumber}"/>
								</h:panelGroup>								
								<h:panelGrid columns="3" >
									<c:forEach items="#{room.beds}" var="bed">
										<h:panelGroup >
											<div style="height:75px; text-align: left; padding:5px; margin: 5px; border: thin solid grey; #{bed.occupied ? 'background-color: gray;':''}">
												<h:panelGroup layout="block">
													<h:selectBooleanCheckbox value="#{bed.selected}" disabled="#{bed.occupied}" />
													<h:outputText value="#{bed.bedNumber}"/>
												</h:panelGroup>
												<h:panelGroup layout="block">															
													<h:outputText value="Rate(A): #{room.rate}" /> 													
												</h:panelGroup>
												<h:panelGroup rendered="#{not bed.occupied}" layout="block">
													<h:panelGroup layout="block">
														<h:outputText value="Rate(P):"/> 
														<h:inputText size="4" value="#{bed.proposedRate}" style="font-size:8pt; width: 23px;"/>
													</h:panelGroup>						
												</h:panelGroup>											
											</div>
										</h:panelGroup>
										<c:set var="found" value="1"/>
									</c:forEach>
								</h:panelGrid>
								<c:if test="#{empty room.beds}" >
									No Beds found
								</c:if>								
							</h:panelGroup>							
						</c:if>															
					</c:forEach>										
				</h:panelGroup>
				<hr/>
			</c:forEach>
			</h:panelGroup>		
			<br/>		
			<a4j:commandButton value="Done" action="#{admissionController.action}" 
								reRender="selectedDormitories" oncomplete="Richfaces.hideModalPanel('dormitorySelectionWindow');"/>
				
		</div>
		</h:form>
	</rich:modalPanel>
	
	<rich:modalPanel id="showErrorsWindow" width="450" zindex="2000" height="300" resizeable="false"  >
			<f:facet name="header">
				<h:outputText value="Checkin Errors"/>
			</f:facet>		
			<h:form>
				<table width="100%" align="left">
					<tr>
						<td valign="top">
							<div style="height:200px; overflow: auto;">					
								<h:messages errorClass="errors" style="color:#ff1111" />
							</div>
						</td>						
					</tr>
					<tr>
						<td>
							<div>
								<h:outputText value="Please correct above errors..." style="background-color: orange; font-weight:bold"/>
							</div>
							<div>			
								<h:commandButton value="OK" onclick="Richfaces.hideModalPanel('showErrorsWindow'); return false;"/>
							</div>
						</td>
					</tr>
				</table>
			</h:form>
	</rich:modalPanel>	
	
	<rich:modalPanel id="submitStatusWindow" width="450" zindex="2000" height="300" resizeable="false"  >
			<f:facet name="header">
				<h:outputText value="Submit Status"/>
			</f:facet>		
			<h:form>
				<table width="100%" align="left">
					<tr>
						<td valign="top">
							<div style="height:200px; overflow: auto;">
								The patient was added successfully ! You should now deposit the security amount.	
								<ul>
									<li>
										<a href="#" onclick="document.location.href='payment.jsf?admissionId=#{admissionController.admissionId}&amp;operation=deposit'">Proceed to security deposit</a>
									</li>
								</ul>
							</div>
						</td>						
					</tr>
					<tr>
						<td>							
							<div>			
								<h:commandButton rendered="false" value="Close to Activate Later" onclick="Richfaces.hideModalPanel('submitStatusWindow'); return false;"/>
							</div>
						</td>
					</tr>
				</table>
			</h:form>
	</rich:modalPanel>		
	
	
	<rich:modalPanel id="selectAttendentWindow" width="450" zindex="2000" height="300" resizeable="false"  >
			<f:facet name="header">
				<h:outputText value="Attendents"/>
			</f:facet>		
			<h:form>
				<table width="100%" align="left">					
					<tr>
						<td valign="top">
							<rich:dataTable rows="5" value="#{admissionController.attendents}" var="aBean" align="center" style="text-align:left">
												<rich:column>
													<h:selectBooleanCheckbox value="#{aBean.selected}" disabled="#{aBean.selected}" /><h:outputText value="#{aBean.name} "/>
												</rich:column>																	
													<f:facet name="footer">
														<rich:datascroller align="center"/>
													</f:facet>
							</rich:dataTable>
						</td>
						<td valign="top">
							<h:panelGrid columns="1">
								<a4j:commandButton reRender="attendentsPanel,selectAttendentWindow" action="#{admissionController.selectAttendents}" oncomplete="Richfaces.hideModalPanel('selectAttendentWindow'); return false;" value="OK" />
								<a4j:commandButton onclick="Richfaces.hideModalPanel('selectAttendentWindow'); return false;" value="Close"/>
							</h:panelGrid>						
						</td>
					</tr>
				</table>
			</h:form>
	</rich:modalPanel>	


	<rich:modalPanel id="confirmAdmissionWindow" width="700" zindex="2000" height="600"  >
			<f:facet name="header">
				<h:outputText value="Checkin Confirmation"/>
			</f:facet>		
			<h:form>
				<table width="100%" align="left">
					<tr>
						<td valign="top" width="80%">
							<table width="100%" align="left" style="text-align: left; table-layout: fixed">
								<tr>
									<td>
										<h:panelGrid columns="2">			
											<h:outputLabel value="First Name:" />
											<h:outputText value="#{admissionController.model.patient.firstName}"/>
											<h:outputLabel value="Middle Name:" />
											<h:outputText value="#{admissionController.model.patient.middleName}"/>
											<h:outputLabel value="Last Name:" />
											<h:outputText value="#{admissionController.model.patient.lastName}"/>
											<h:outputLabel value="Address:" />
											<h:outputText value="#{admissionController.model.patient.address}"/>
											<h:outputLabel value="Sex:" />
											<h:outputText value="#{admissionController.model.patient.sex == 'M' ? 'Male' : 'Female'}"/>							
											<h:outputLabel value="ID Card Type:"/>
											<h:outputText value="#{admissionController.model.patient.idCardType}" converter="#{idCardTypeConverter}" />
											<h:outputLabel value="ID Card Number:" />
											<h:outputText value="#{admissionController.model.patient.idCardNumber}"/>
											<h:outputLabel value="Phone Number:" />
											<h:outputText value="#{admissionController.model.patient.phone}"/>
											<h:outputLabel value="Profession" />
											<h:outputText value="#{admissionController.model.patient.profession}" converter="#{professionConverter}"/>
											<h:outputLabel value="Medical Problem"/>
											<h:outputText  value="#{admissionController.model.medicalProblem}" converter="#{medicalProblemConverter}"/>
											<h:outputLabel value="Case Number:" style="color:red"/>
											<h:outputText value="#{admissionController.model.caseNo}" />							
											<h:outputLabel value="Town of Last Departure"/>
											<h:outputText value="#{admissionController.model.townOfLastDeparture}"/>
											<h:outputLabel value="Stay from: "/>
											<h:outputText value="#{admissionController.model.dateFrom}">
												<f:convertDateTime pattern="dd MMM yy HH:mm" />
											</h:outputText>
											<h:outputLabel value="Stay to: "/>
											<h:outputText value="#{admissionController.model.dateTo}">
												<f:convertDateTime pattern="dd MMM yy HH:mm" />
											</h:outputText>							
										</h:panelGrid>
									</td>
									<td valign="top">
										<div style="color:red">Photograph</div>
										<div id="confirmSnap">
											<img id="imgctrl2" src="" width="320px" height="240px" border="1" alt="No Photograph"/>																
										</div>
									</td>
								</tr>
								<tr>
									<td valign="top" align="left">
										<rich:dataTable value="#{admissionController.currentAttendentsData}" var="aBean" align="center" style="text-align:left">
												<f:facet name="header">
													<h:outputText value="Attendents"/>
												</f:facet>									
												<rich:column>
													<f:facet name="header">Name</f:facet>
													<h:outputText value="#{aBean.attendent.name} "/>
												</rich:column>																	
												<c:if test="#{empty admissionController.currentAttendentsData or admissionController.currentAttendentsData.rowCount le 0}">
													<f:facet name="footer">
														<h:outputText value="No Attendents..." />
													</f:facet>
												</c:if>	
											</rich:dataTable>
									</td>
									<td>								
											<h:panelGrid columns="1">			
												<h:panelGroup>				
													<h:outputLabel value="Rooms: " style="color:red"/>
													<h:panelGroup>			
														<c:set var="found" value="0"/>
														<ul>				
															<c:forEach items="#{admissionController.buildings}" var="building">
																<c:forEach items="#{building.rooms}" var="room">
																	<c:if test="#{ not room.dormitory and room.selected}">					
																		<li>#{room.roomNumber} ( #{building.name} )</li>
																		<c:set var="found" value="1"/>
																	</c:if> 	
																</c:forEach>
															</c:forEach>
															<c:if test="#{found eq 0}" >	
																<li>No Rooms Selected</li>
															</c:if>		
														</ul>
													</h:panelGroup>
												</h:panelGroup>
												<h:panelGroup>
													<h:outputLabel value="Dormitory Beds: " style="color:red"/>
													<h:panelGroup>			
														<c:set var="found" value="0"/>
														<ul>
															<c:forEach items="#{admissionController.buildings}" var="building">
																<c:forEach items="#{building.rooms}" var="room">
																	<c:if test="#{room.dormitory}" >
																		<c:forEach items="#{room.beds}" var="bed">
																			<c:if test="#{ bed.selected}" >	
																				<li>#{bed.bedNumber} ( #{building.name} - #{room.roomNumber} )</li>
																				<c:set var="found" value="1"/>
																			</c:if>
																		</c:forEach>
																	</c:if> 	
																</c:forEach>
															</c:forEach>
															<c:if test="#{found eq 0}" >	
																<li>No Beds Selected</li>
															</c:if>		
														</ul>
													</h:panelGroup>
												</h:panelGroup>
											</h:panelGrid>								
									</td>					
								</tr>
								<tr>
									<td valign="top" align="left" colspan="2">
										<div style="font-weight: bold">
											Material and Utensil Set
										</div>
									</td>
								</tr>
								<tr>
									<td valign="top" align="left" colspan="1">										
										<div>
											<h:panelGrid columns="8">			
												<c:forEach items="#{admissionController.materialAllocations}" var="materialAllocation">
													<h:outputLabel value="#{materialAllocation.materialType.name}"/>
													<h:outputText value="#{materialAllocation.instances}" style="width: 15px; margin-right:15px; "/>
												</c:forEach>
											</h:panelGrid>
										</div>
									</td>
									<td valign="top" align="left" colspan="1">
										<div>									
											<h:outputLabel value="Utensils Set:" style="color:red"/>
											<h:outputText value="#{admissionController.model.materialSet}" converter="#{materialSetConverter}"/>
										</div>
										<div>											
										</div>																
									</td>
								</tr>
								<tr>
									<td colspan="2" style="background-color: gray;">
										&nbsp;						
									</td>
								</tr>															
							</table>
						</td>
						<td valign="top" width="20%">
							<div>
								<h:outputText value="Are you sure to submit ?" style="color: red; font-weight:bold"/>
							</div>
							<div>									
									<a4j:commandButton 	action="#{admissionController.add}" status="valsub123"
										value="Submit" 
										reRender="submitStatusWindow" 
										oncomplete="if(! #{admissionController.error}) Richfaces.showModalPanel('submitStatusWindow'); else alert('Error while adding: #{admissionController.errors[0]} \nPlease check the data and retry !');"/>
									<a4j:status id="valsub123" forceId="true">
										 <f:facet name="start">
							                  <h:graphicImage value="/images/im1.gif"/>
							             </f:facet>
									</a4j:status>
							</div>
							<div>			
								<h:commandButton value="Cancel" onclick="Richfaces.hideModalPanel('confirmAdmissionWindow'); return false;"/>								
							</div>													
						</td>
					</tr>
				</table>
			</h:form>
	</rich:modalPanel>
	
	</ui:define>
</ui:composition>